package website.haicheng.core.util;


import org.springframework.util.StringUtils;
import website.haicheng.core.exceptions.util.ConstraintNotMatchException;

import java.util.Objects;

/**
 * @description:
 * @author: 582895699@qq.com
 * @time: 2021/2/8 下午 11:24
 */
public class Assert extends org.springframework.util.Assert {

    public static void notBlack(String str, String message) {
        if (!StringUtils.hasText(str)) {
            throw new ConstraintNotMatchException(message);
        }
    }

    public static void notNull(Object object, String message) {
        if (Objects.isNull(object)) {
            throw new ConstraintNotMatchException(message);
        }
    }

    public static void stat(boolean bool, String message) {
        if (bool) {
            throw new ConstraintNotMatchException(message);
        }
    }
}
